package inits

import (
	"fmt"
	"github.com/streadway/amqp"
	"yk3.19/global"
)

func InitRabbitMq() {

	//获取connection
	conn, err := amqp.Dial("amqp://2210a:2210a@14.103.169.25:5672/2210a")
	if err != nil {
		panic("Failed to connect to RabbitMQ")
	}
	//获取channel
	global.MQ, err = conn.Channel()

	if err != nil {
		panic("Failed to open a channel")
	}

	fmt.Println("Connected to RabbitMQ")

}
